<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
            "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
    <head>
        <title>CurStyles Performance Test/Demo</title>
        <style type='text/css'>
            body {font-family: verdana}
			#content {height: 100px; width: 300px; 
			margin: 20px; 
			padding: 10px; 
			border: solid 1px black;
			cursor: pointer;
			}
        </style>
    </head>
    <body>
    	<h1>CurStyles Performance</h1>
		<p>This demo shows how $.curStyles out-performs $.curCSS</p>
<div id="demo-html">
<div id='content'>
	Click To Run
</div>
</div>
<script type='text/javascript'  
        src='../../../steal/steal.js'></script>


<script type='text/javascript' id="demo-source">
steal('jquery/dom/cur_styles').then(function(){
	
$.fn.fastHeight = function(){
	var sum = this[0] && this[0].offsetHeight;
	$.each(this.curStyles(
		"borderTopWidth",
		"borderBottomWidth",
		"paddingTop",
		"paddingBottom"), function(name, val){
			sum -= parseInt(val) || 0;
		});
	return sum;
}


var test = function(func){
	var start = new Date(),
		content = $("#content");
	for(var i =0; i < 2000; i++){
		content[func]()
	}
	return ( new Date() - start );
};


$("#content").click(function(){
	var height = test("height"),
		fastheight = test("fastHeight");
	$("#content").html("jQuery's height: <b>"+
		height+
		"</b>ms<br/>fastHeight: <b>"+
		fastheight+
		"</b>ms"
		)
});

});

</script>
    </body>
</html>